scp -r root@10.15.180.89:/media/* ./


vi /etc/yum.repos.d/CentOS-Base.repo
[centos7-media]
name=Centos linux 7.0
baseurl=file:///media/CentOS-7-x86_64-DVD-1908
enabled=1
gpgcheck=1
gpgkey=file:///media/CentOS-7-x86_64-DVD-1908/RPM-GPG-KEY-CentOS-7


yum  install -y  gcc  gcc-c++   pam-devel  telnet telnet-server xinetd

没有yum源，可以传RPM包安装
rpm -ivh xinetd-2.3.15-13.el7.x86_64.rpm
rpm -ivh telnet-0.17-64.el7.x86_64.rpm 
rpm -ivh telnet-server-0.17-64.el7.x86_64.rpm 

检查是否有telnet文件的disables是否是no,如果没有这个文件，新增如下
vi /etc/xinetd.d/telnet

service telnet         
{  
  flags = REUSE  
  socket_type = stream  
  wait = no  
  user = root  
  server =/usr/sbin/in.telnetd  
  log_on_failure += USERID  
  disable = no   
}

启动Telnet和xinetd,检查23端口，如果有防火墙，需要放开23端口
systemctl start telnet.socket && systemctl start xinetd
netstat -lntp|grep 23


getenforce && more /etc/selinux/config
检查SELINUX是否是disabled，如果不是要改成disabled

mkdir  -pv /usr/soft
scp root@10.15.180.89:/usr/soft/*.tar.gz /usr/soft/
cd /usr/soft/

tar -xzf zlib-1.2.11.tar.gz 
tar -xzf openssl-1.1.1e.tar.gz 
tar -xzf openssh-8.2p1.tar.gz 

chown root:root -R openssh-8.2p1
chown root:root -R zlib-1.2.11


mv  /etc/ssh /etc/ssh_bak
mv /usr/bin/openssl /usr/bin/openssl_bak
mv /usr/include/openssl    /usr/include/openssl_bak

cd /usr/soft/zlib-1.2.11
./configure --prefix=/usr/local/zlib && make && make install

cd /usr/soft/openssl-1.1.1e
./config --prefix=/usr/local/ssl -d shared && make && make install

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
/sbin/ldconfig

openssl version

cd /usr/soft/openssh-8.2p1
./configure --prefix=/usr/local --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/ssl  --with-openssl-includes=/usr/local/ssl/include --with-zlib=/usr/local/zlib --with-md5-passwords --with-pam && make && make install

cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

vi /etc/ssh/sshd_config
内容替换成模板的

mv /usr/bin/ssh /usr/bin/ssh_bak
cp /usr/local/bin/ssh /usr/bin/ssh
mv /usr/sbin/sshd /usr/sbin/sshd_bak
cp /usr/local/sbin/sshd /usr/sbin/sshd


chmod 755 /usr/bin/ssh
chmod 755 /usr/sbin/sshd
chmod 755 /usr/bin/openssl
chmod 755 /usr/include/openssl
chmod 755 /usr/local/ssl
chmod 755 /usr/local/ssl/*


mv  /usr/lib/systemd/system/sshd.service  /usr/soft



chmod +x /etc/init.d/sshd

chkconfig --add sshd  && systemctl enable sshd  && chkconfig sshd on


systemctl daemon-reload  && systemctl restart sshd.service  &&  ps -ef|grep sshd


vi /etc/xinetd.d/telnet
service telnet         
{  
  flags = REUSE  
  socket_type = stream  
  wait = no  
  user = root  
  server =/usr/sbin/in.telnetd  
  log_on_failure += USERID  
  disable = yes   
}

systemctl stop xinetd.service && systemctl stop telnet.socket  &&  systemctl disable xinetd.service  && systemctl disable telnet.socket

rpm -qa|grep telnet

chkconfig --list  telnet

netstat -lntp|grep 23
